const path = require('path')

const basePath = __dirname
const uploadPath = path.join(__dirname, '../public/upload')

// info 页统一参数
function getInfoOptions({ title, content, hrefUrl, hrefTitle, info }) {
  return {
    title: title || '',
    content: content || '',
    hrefUrl: hrefUrl || '',
    hrefTitle: hrefTitle || '',
    info: info || '',
  }
}

/**
 * 统一res返回格式
 * @param {Objec} param0 { code：0正常，1异常, msg：信息, data：信息对象 }
 */
function resJsonObject({ code, msg, data }) {
  return {
    code: code,
    msg: msg,
    data: data || {},
  }
}

/**
 * 挂号状态
 * 1未看病，2已过期，3已看病
 */
const recordsStatusArr = [
  {
    id: 1,
    value: '未看病',
  },
  {
    id: 2,
    value: '已过期',
  },
  {
    id: 3,
    value: '已看病',
  },
]

module.exports = {
  basePath,
  uploadPath,
  getInfoOptions,
  resJsonObject,
  recordsStatusArr,
}
